Add Laravel artisan completion#2349
Merged
seefood merged 3 commits intoBash-it:masterfrom Oct 8, 2025
Merged
Conversation
Implements tab completion for Laravel's artisan command-line tool. **Features:** - Dynamic command completion from `php artisan list` - Works with both `artisan` and `art` aliases - Only activates when artisan file exists in current directory - Uses `command` prefix to bypass user aliases for robustness - Follows bash-it completion conventions **Implementation:** - Parses `php artisan --raw --no-ansi list` output - Provides completions via bash's `compgen` builtin - Gracefully handles missing artisan file or PHP errors - Passes shellcheck and shfmt linting **Use Case:** Developers working with Laravel projects can now tab-complete artisan commands like `make:controller`, `migrate`, `tinker`, etc., improving productivity and reducing typos. Closes Bash-it#2248 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
seefood
added a commit
that referenced
this pull request
Oct 7, 2025
Updated all three planning documents to reflect the completed work: **Issues Fixed (6 total)**: - #2317: Auto-detect git remote (PR #2345) - #2248: Laravel artisan completion (PR #2349) - #2296: down4me URL malformation (PR #2350) - #2260: SSH completion @ sign (PR #2351) - #2238: Uninstall script backup (PR #2352) - #2216: Node version conditional display (PR #2353) **Changes to docs/plans/**: 1. bash-it-issues-comprehensive-analysis.md - Marked 5 quick wins as FIXED with PR numbers - Updated executive summary: 32 → 27 open issues - Updated work plan to show Phase 1 completed - Updated issue reference appendix 2. bash-it-quick-reference.md - Moved completed issues to "Fixed" section - Updated TL;DR metrics - Removed completed items from decision list - Updated metrics table with current progress 3. bash-it-roadmap-2025.md - Updated health metrics (32 → 27 issues) - Marked Phase 1 as COMPLETED - Listed all 6 PRs with dates - Updated success criteria checkmarks **Remaining Work**: - 1 quick fix (#2314 - todo alias rename) - 18 stale issues to close - 4 strategic decisions needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
akinomyoga
reviewed
Oct 7, 2025
Applied 3 of 4 review suggestions from @akinomyoga: 1. Fixed comment - only checks current directory, not parent directories 2. Removed unnecessary /g flag from sed substitution 3. Combined two complete commands into one line Note on compgen -W quoting: Kept double quotes as single quotes would prevent variable expansion. The SC2034 warning is a false positive since commands is used in compgen. Artisan commands are safe (no special chars). Co-Authored-By: akinomyoga <akinomyoga@users.noreply.github.com>
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
|
|
||
| # Get list of available artisan commands | ||
| # Use command prefix to bypass user aliases | ||
| commands=$(command php artisan --raw --no-ansi list 2> /dev/null | command sed "s/[[:space:]].*//") |
Check warning
Code scanning / shellcheck
SC2034 Warning
| commands=$(command php artisan --raw --no-ansi list 2> /dev/null | command sed "s/[[:space:]].*//") | ||
|
|
||
| # shellcheck disable=SC2034,SC2207 | ||
| COMPREPLY=($(compgen -W '${commands}' -- "${cur}")) |
Check warning
Code scanning / shellcheck
SC2016 Warning
akinomyoga
reviewed
Oct 7, 2025
| # Use command prefix to bypass user aliases | ||
| commands=$(command php artisan --raw --no-ansi list 2> /dev/null | command sed "s/[[:space:]].*//") | ||
|
|
||
| # shellcheck disable=SC2034,SC2207 |
Contributor
There was a problem hiding this comment.
Suggested change
| # shellcheck disable=SC2034,SC2207 | |
| # shellcheck disable=SC2016,SC2207 |
| fi | ||
|
|
||
| # Get list of available artisan commands | ||
| # Use command prefix to bypass user aliases |
Contributor
There was a problem hiding this comment.
Suggested change
| # Use command prefix to bypass user aliases | |
| # Use command prefix to bypass user aliases | |
| # shellcheck disable=SC2034 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements tab completion for Laravel's artisan command-line tool, addressing issue #2248.
Features
php artisan listartisanand the commonartaliasartisanfile exists in the current directorycommandprefix to bypass user aliases, ensuring reliabilityImplementation Details
The completion function:
artisanfile in the current directoryphp artisan --raw --no-ansi listcompgenbuiltinUsage
After enabling the completion:
bash-it enable completion artisanUsers can tab-complete artisan commands:
Testing
Related
Closes #2248
Test Plan
To test this completion:
bash-it enable completion artisanphp artisan make:<TAB>orartisan migr<TAB>🤖 Generated with Claude Code